
// to memory.h
#define T_NUM (3);

typedef struct {
    void *tree;
    void *base;
} Para;



// to main.c

#include <pthread.h>


Para peremeter;
peremeter.tree = (void *)p_tree;
peremeter.base = (void *)base;

pthread_t *proc = (pthread_t *)malloc(T_NUM * sizeof(pthread_t));
for (i = 0; i < T_NUM; i++) {
    if (i%2 == 1) {
        if (pthread_create(&proc[i], NULL, (void *)process2, paremeter) != 0)
            printf("fail to create thread.\n");
    }
    else {
        if (pthread_create(&proc[i], NULL, (void *)process1, paremeter) != 0)
            printf("fail to create thread.\n");

    }
}


        pthread_t proc1;
        pthread_t proc2;
        pthread_t proc3;
        if (pthread_create(&proc1, NULL, (void *)process1, NULL) != 0)
                printf("fail to create thread.\n");
        if (pthread_create(&proc2, NULL, (void *)process2, NULL) != 0)
                printf("fail to create thread.\n");
        if (pthread_create(&proc3, NULL, (void *)process1, NULL) != 0)
                printf("fail to create thread.\n");



void *
process1(void *arg) {


    Para *pa = (Para *)arg;

    int size = 100;

    void *p = get_memory(size);
    p = grow_memory(p, size+20);

    p = pregrow_memory(p, size+30);

    release_memory(p);

}

void *
process2(void *arg) {


    Para *pa = (Para *)arg;

    int size = 200;

    void *p = get_memory(size);
    p = grow_memory(p, size+10);

    //release_memory(p);

}






